var app = getApp()
Page({
  data: {
    screenWidth: 350,
    leftitems: [],
    rightitems: [],
  },
  async onLoad(){
     this.get()
  },
  async onPullDownRefresh(){
    
    await this.get()
    wx.stopPullDownRefresh()

  },
  async get(){
    wx.showLoading({
      title: '努力加载中...',
      mask:true
    })
    let openid = app.globalData.openid?app.globalData.openid:''
    console.log(openid)
    let res = await wx.cloud.callFunction({
      name:'getComment',
      data:{
        openid
      }
    })
    console.log(res)
    var screenWidth = await wx.getSystemInfoSync().screenWidth; //计算宽度
    this.setData({
      screenWidth: screenWidth / 2-7,
      leftitems:res.result.leftitems,
      rightitems:res.result.rightitems
    });
    wx.hideLoading()
  }
})